// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_b.p_a;

import android.content.Context;
import android.net.DhcpInfo;
import android.net.wifi.WifiManager;
import com.nnee.p_fk.p_b.cls_a;
import com.nnee.p_fk.p_b.cls_c;
import com.nnee.p_g.cls_b;
import com.nnee.p_pr.p_prot.cls_PRISFbResultInfo;
import java.net.InetAddress;
import java.net.UnknownHostException;

import org.json.JSONException;
import org.json.JSONObject;

// Referenced classes of package com.nnee.b.a:
//            d

public class cls_af extends cls_a {

	protected cls_af(String s, String s1, String s2, boolean flag) {
		super(2200);

		int l = 1;

		g = 0;
		i = l;
		a = 16029L;
		b = s;
		c = s1;
		d = flag;
		if (!d)
			l = 2;
		g = l;
		f = s2;
	}

	private static String a(int l) {
		return (new StringBuilder()).append(l & 0xff).append(".")
				.append(0xff & l >> 8).append(".").append(0xff & l >> 16)
				.append(".").append(0xff & l >> 24).toString();
	}

	private void a() {
		InetAddress ainetaddress[] = null;
		int l;
		try {
			ainetaddress = InetAddress.getAllByName("cdn.easyread.163.com");
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if (ainetaddress == null)
			return;
		l = ainetaddress.length;
		Exception exception;
		WifiManager wifimanager;
		DhcpInfo dhcpinfo;
		for (int i1 = 0; i1 < l; i1++) {
			InetAddress inetaddress = ainetaddress[i1];
			if (inetaddress != null)
				com.nnee.p_g.cls_b.b("cdn ip", (new StringBuilder()).append("")
						.append(inetaddress.getHostAddress()).toString());

		}

		wifimanager = (WifiManager) com.nnee.p_b.p_a.cls_d.h().a()
				.getSystemService("wifi");
		if (wifimanager != null) {
			dhcpinfo = wifimanager.getDhcpInfo();
			if (dhcpinfo != null) {
				com.nnee.p_g.cls_b.b("dns1", a(dhcpinfo.dns1));
				com.nnee.p_g.cls_b.b("dns2", a(dhcpinfo.dns2));
				com.nnee.p_g.cls_b.b("ipAddress", a(dhcpinfo.ipAddress));
				com.nnee.p_g.cls_b
						.b("serverAddress", a(dhcpinfo.serverAddress));
				com.nnee.p_g.cls_b.b("gateway", a(dhcpinfo.gateway));
			}
		}

	}

	public void a(int l, Object obj) {
		String s = (String) obj;
		if (!d) {
			if (n() == 2) {
				if (s.equals("true"))
					c(0, new cls_PRISFbResultInfo("success"));
				else
					c(0, new cls_PRISFbResultInfo("failed"));
				g = 3;
			}
			if (g != 3)
				g().a(this);
			return;

		} else {
			if (g != 1) {
				if (g == 2)

				{
					if (s.equals("true"))
						c(0, new cls_PRISFbResultInfo("success"));
					else
						c(0, new cls_PRISFbResultInfo("failed"));
					g = 3;
				}
			} else {
				JSONObject jsonobject;
				try {
					jsonobject = new JSONObject(s);
				} catch (JSONException jsonexception) {
					jsonexception.printStackTrace();
					jsonobject = null;
				}
				if (jsonobject.optBoolean("success")) {
					e = jsonobject.optString("fileId");
					g = 2;
				} else {
					g = 3;
				}
			}
			if (g != 3)
				g().a(this);
			return;
		}

	}

	protected void b(int l, Object obj) {
		d(l, obj);
	}

	public void c() {
		com.nnee.p_fk.p_a.cls_m m = null;
		if (!d) {
			m = com.nnee.p_pr.p_prot.cls_c.a(a, f, b, c, e);
			a(m);
			return;
		} else {
			if (g != 1) {
				if (g == 2)
					m = com.nnee.p_pr.p_prot.cls_c.a(a, f, b, c, e);
			} else {
				a();
				m = com.nnee.p_pr.p_prot.cls_c.c();
			}
			a(m);
			return;
		}
	}

	private long a;
	private String b;
	private String c;
	private boolean d;
	private String e;
	private String f;
	private int g;
	private final int i;
	private final int j = 2;
	private final int k = 3;
}
